<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <title>碳达人</title>
    <link rel="stylesheet" th:href="@{/libs/bootstrapvalidator/css/bootstrapValidator.min.css}"/>
    <link rel="stylesheet" th:href="@{/libs/fireui/accordion.css}"/>
    <link rel="stylesheet" th:href="@{/libs/fireui/table.css}"/>
    <link rel="stylesheet" th:href="@{/cweb/css/calculator.css}"/>
    <link rel="stylesheet" th:href="@{/cweb/css/customer-20211209.css}"/>

</head>
<body>
<header id="header">
    <div th:replace="home/cfragments/navbar :: cnavbar"></div>
</header>
<span th:if="${CURRENT_CUSTOMER == null}">
    <span id="no_login"></span>
</span>

<div class="main-container">
    <div class="content">
        <div class="calc_one_main">
            <div class="calc_sub calc_one_left">
                <img th:src="@{/cweb/img/cacl.png}">
                <div class="calc_text">
                    <span style="font-size: 24px">简易算法（化工行业）：</span>
                    <p style="font-weight:bold;">E<sub>CO<sub>2</sub>_燃烧</sub>&nbsp;：&nbsp;&nbsp;化石燃料燃烧产生的二氧化碳排放量，单位为t</p>
                    <p style="font-weight:bold;">E<sub>GHG_过程</sub>&nbsp;：&nbsp;&nbsp;工业生产过程产生的各种温室气体CO<sub>2</sub>当量排放，单位为t
                    </p>
                    <p style="font-weight:bold;">E<sub>GHG_回收</sub>&nbsp;：&nbsp;&nbsp;回收且外供的CO<sub>2</sub>量，单位为t</p>
                    <p style="font-weight:bold;">E<sub>GHG_净电</sub>&nbsp;：&nbsp;&nbsp;净购入的电力消费引起的CO<sub>2</sub>排放，单位为t</p>
                    <p style="font-weight:bold;">E<sub>GHG_净热</sub>&nbsp;：&nbsp;&nbsp;净购入的热力消费引起的CO<sub>2</sub>排放，单位为t</p>
                </div>
            </div>
            <div class="calc_sub calc_one_right">
                <div class="calc_top">
                    <form class="form-horizontal" id="eghgoneForm">
                        <div class="form-group">
                            <label for="eco2Burn" class="col-sm-4 control-label">E<sub>CO<sub>2</sub>_燃烧</sub></label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="eco2Burn" name="eco2Burn"
                                       placeholder="请输入企业边界内化石燃料燃烧产生的CO2排放量">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="eghgProcess" class="col-sm-4 control-label">E<sub>GHG_过程</sub></label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="eghgProcess" name="eghgProcess"
                                       placeholder="请输入企业边界内工业生产过程产生的各种温室气体CO2当量排放">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="eghgRecovery" class="col-sm-4 control-label">E<sub>GHG_回收</sub></label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="eghgRecovery" name="eghgRecovery"
                                       placeholder="请输入企业回收且外供的CO2量">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="eghgNetElectricity" class="col-sm-4 control-label">E<sub>GHG_净电</sub></label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="eghgNetElectricity"
                                       name="eghgNetElectricity"
                                       placeholder="请输入企业净购入的电力消费引起的CO2排放">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="eghgNetHeat" class="col-sm-4 control-label">E<sub>GHG_净热</sub></label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="eghgNetHeat" name="eghgNetHeat"
                                       placeholder="请输入企业净购入的热力消费引起的CO2排放">
                            </div>
                        </div>
                    </form>
                </div>
                <div class="calc_line"></div>
                <div class="calc_bottom">
                    <button class="btn btn-info" onclick="eghgOne()" type="button">
                        计算&nbsp;&nbsp;&nbsp;&nbsp;E<sub>GHG</sub></button>
                    <div id="eghgOneResult"></div>
                </div>
            </div>
        </div>
        <div class="calc_one_other">
            <div class="calc_one_other_left calc_one_other_main" id="calculator_two">
                <div class="title">企业用户专享</div>
                <div class="content">高级版</div>
            </div>
            <div class="calc_one_other_right calc_one_other_main" id="calculator_three">
                <div class="title">企业用户专享</div>
                <div class="content">专业版</div>
            </div>
        </div>
    </div>
</div>
<div>
    <div th:replace="home/cfragments/float_right :: cfloatright"></div>
</div>
<div class="footer">
    <div th:replace="home/cfragments/footer :: cfooter"></div>
</div>
<script th:src="@{/libs/bootstrap/bootstrap.min.js}"></script>
<script th:src="@{/libs/bootstrapvalidator/js/bootstrapValidator.js}"></script>
<script>

    $(function () {
        $('#tdr').addClass('th-bg');
        if ($('#no_login').length == 1) {
            userLogin();
        }

        $('#calculator_two').click(function () {
            window.location.href = '/blog/calculator/two';
        });

        $('#calculator_three').click(function () {
            window.location.href = '/blog/calculator/three';
        });

        $('#eghgoneForm').bootstrapValidator({
            message: 'This value is not valid',
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                eco2Burn: {
                    message: '企业边界内化石燃料燃烧产生的CO2排放量验证失败',
                    validators: {
                        notEmpty: {
                            message: '请输入企业边界内化石燃料燃烧产生的CO2排放量'
                        },
                        regexp: {
                            regexp: /^[0-9]+\.[0-9]{2}$/,
                            message: '只能输入保留两位小数的数字'
                        }
                    }
                },
                eghgProcess: {
                    message: '企业边界内工业生产过程产生的各种温室气体CO2当量排放验证失败',
                    validators: {
                        notEmpty: {
                            message: '请输入企业边界内工业生产过程产生的各种温室气体CO2当量排放'
                        },
                        regexp: {
                            regexp: /^[0-9]+\.[0-9]{2}$/,
                            message: '只能输入保留两位小数的数字'
                        }
                    }
                },
                eghgRecovery: {
                    message: '企业回收且外供的CO2量验证失败',
                    validators: {
                        notEmpty: {
                            message: '请输入企业回收且外供的CO2量'
                        },
                        regexp: {
                            regexp: /^[0-9]+\.[0-9]{2}$/,
                            message: '只能输入保留两位小数的数字'
                        }
                    }
                },
                eghgNetElectricity: {
                    message: '企业净购入的电力消费引起的CO2排验证失败',
                    validators: {
                        notEmpty: {
                            message: '请输入企业净购入的电力消费引起的CO2排放'
                        },
                        regexp: {
                            regexp: /^[0-9]+\.[0-9]{2}$/,
                            message: '只能输入保留两位小数的数字'
                        }
                    }
                },
                eghgNetHeat: {
                    message: '企业净购入的热力消费引起的CO2排放验证失败',
                    validators: {
                        notEmpty: {
                            message: '请输入企业净购入的热力消费引起的CO2排放'
                        },
                        regexp: {
                            regexp: /^[0-9]+\.[0-9]{2}$/,
                            message: '只能输入保留两位小数的数字'
                        }
                    }
                }
            }
        });


        $('.one').mouseover(function () {
            enterCard($(this));
        });

        $('.one').mouseout(function () {
            outCard($(this));
        });

        $('.two').mouseover(function () {
            enterCard($(this));
        });

        $('.two').mouseout(function () {
            outCard($(this));
        });

        $('.three').mouseover(function () {
            enterCard($(this));
        });

        $('.three').mouseout(function () {
            outCard($(this));
        });
    });


    function enterCard(obj) {
        //边框变蓝色
        obj.find('div').addClass('card-main-mouseenter');
        obj.find('button').addClass('card-button-mouseenter')
    }

    function outCard(obj) {
        obj.find('div').removeClass('card-main-mouseenter')
        obj.find('button').removeClass('card-button-mouseenter')
    }

    function eghgOne() {
        var flag = $('#eghgoneForm').data('bootstrapValidator').isValid();
        if (flag) {
            Core.postAjax("/blog/eghg/api/eghgone", $('#eghgoneForm').serialize(), function (data) {
                $('#eghgOneResult').html(data.data.result)
            });
        }
    }
</script>
</body>
</html>